package com.itfreer.gis.map.resource;

import com.alibaba.dubbo.config.annotation.Service;
import com.itfreer.form.api.BaseDao;
import com.itfreer.form.api.DictionaryServiceImp;
import com.itfreer.form.api.dictionary.DictionaryEntity;
import com.itfreer.gis.map.resource.dao.ResourceContentDao;
import com.itfreer.gis.map.resource.entity.ResourceContentEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 资源目录实现类
 */
@Component
@Service(interfaceClass = ResourceContentService.class, path = "gisresourcecontent")
public class ResourceContentServiceImpl extends DictionaryServiceImp<ResourceContentEntity> implements ResourceContentService {
	
	@Autowired
	private ResourceContentDao dao;

	@Override
	public String getDictionaryName() {
		return "p_gisresourcecontent";
	}

	@Override
	public String getServiceName() {
		return "GisResourceContentService";
	}


	/**
	 * 是否是树表
	 */
	protected boolean isTree() {
		return true;
	}

	/**
	 * 树的PID字段名
	 */
	protected String getTreePIDFieldName() {
		return "pid";
	}

	@Override
	protected DictionaryEntity convert(ResourceContentEntity entity) {
		DictionaryEntity toEntity = new DictionaryEntity();
		BeanUtils.copyProperties(entity, toEntity);
		return toEntity;
	}

	@Override
	protected String getDictionaryFields() {
		return "*";
	}

    @Override
    protected BaseDao<ResourceContentEntity> getDao() {
        return dao;
    }

    @Override
    protected boolean isTenant() {
        return false;
    }
}
